//
// Created by liushuai on 12/21/19.
//
double mypow2(double x, int n) {
    {
        long long N = n;
        if (n < 0) {
            x = 1 / x;
            N = -N;
        }
        double ans = 1;
        double current_product = x;
        for (long long i = N; i; i /= 2) {
            if (i&1)
                ans = ans * current_product;
            current_product = current_product * current_product;
        }
        return ans;
    }
}
